package com.nt.redisdemo.nt.controller;


import com.cebbank.essp.common.service.RedisOpsService;
import com.nt.redisdemo.nt.entity.KeyCompareVO;
import com.nt.redisdemo.nt.service.EasyExcelService;
import com.nt.redisdemo.nt.service.KeyCompareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.*;

@RestController
@RequestMapping("nt")
public class NtController {

    @Autowired
    KeyCompareService keyCompareService;

    @Autowired
    EasyExcelService easyExcelService;


    /**
     * hello Word 测试
     * @return
     */
    @RequestMapping("/hello")
    @ResponseBody
    public String hello() {
        return "Hello ";
    }

    /**
     * 接收 List<KeyCompareVO> 参数并将其转化为 JSON，key 为 filedCode，value 为 fieldName
     *
     * @param keyCompareVOList 输入的参数列表
     * @return 转化后的 JSON 字符串
     */
    @PostMapping("/convertToJson")
    public String convertToJson(@RequestBody List<KeyCompareVO> keyCompareVOList) {
        String s = keyCompareService.convertToJson(keyCompareVOList);
        return s;
    }


    /**
     * easyExcel测试
     * @return
     */
    @RequestMapping("/easyExcelTest")
    @ResponseBody
    public String easyExcelTest() {
        String s = easyExcelService.easyExcelTest();
        return "Hello ";
    }


}
